package com.test.amqp;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 一个消息消费者
 */
@Component
public class DirectReceiver {

    @RabbitListener(queues = "root-queue")
    public void handler(String msg) {
        int i = 0;
        while (i < 20) {
            i++;
            try {
//                Thread.sleep(500);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        System.out.println("DirectReceiver: " + msg);
    }
}
